import os

from tag.base.baseModel import BaseModel

# 0.设置系统环境变量
os.environ['JAVA_HOME'] = '/export/server/jdk1.8.0_241/'
os.environ['SPARK_HOME'] = '/export/server/spark'
os.environ['PYSPARK_PYTHON'] = '/root/anaconda3/envs/pyspark_env/bin/python'
os.environ['PYSPARK_DRIVER_PYTHON'] = '/root/anaconda3/envs/pyspark_env/bin/python'

class marriage(BaseModel):
    def compute(self,es_df,five_df):
        es_df.printSchema()
        es_df.show()
        five_df.printSchema()
        five_df.show()
        new_df=es_df.join(other=five_df,
                          on=es_df['marriage']==five_df['rule'],
                          how='left').select(es_df['id'].alias("userId"),five_df['id'].alias("tagsId"))
        return new_df
if __name__ == '__main__':
    marriage=marriage(66)
    marriage.execute()